package com.maiji.cloud.controller;

import com.maiji.cloud.request.BaseInputDto;
import com.maiji.cloud.request.IdInputDto;
import com.maiji.cloud.response.BaseOutPutDto;
import com.maiji.cloud.service.ComMsgCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/community")
@Api(value = "论坛模块")
public class ComMsgCollectController {

    @Autowired
    ComMsgCollectService collectService;

    @PostMapping("/collect")
    @ApiOperation("动态收藏")
    public BaseOutPutDto<String> collect(@RequestBody BaseInputDto<IdInputDto> inputDto , @RequestHeader("maijiToken")String maijiToken){
        return collectService.collect(inputDto,maijiToken);
    }

    @PostMapping("/cancelCollect")
    @ApiOperation("取消动态收藏")
    public BaseOutPutDto<String> cancelCollect(@RequestBody BaseInputDto<IdInputDto> inputDto ,@RequestHeader("maijiToken")String maijiToken){
        return collectService.cancelCollect(inputDto,maijiToken);
    }

    /**
     * 批量删除用户收藏动态（空参为清空收藏）
     * @param inputDto
     * @param maijiToken
     * @return
     */
    @PostMapping("/cancelCollectionMsgs")
    @ApiOperation("批量删除用户收藏动态（空参为清空收藏）")
    public BaseOutPutDto cancelCollectionMsgs(@RequestBody BaseInputDto<List<String>> inputDto, @RequestHeader("maijiToken")String maijiToken){
        return collectService.cancelCollectionMsgs(inputDto,maijiToken);
    }



}

